// home小仓库
import {getBaseCategoryList,reqBannerList,reqFloorsList} from '@/api/index'
const state = {
    categoryList:[],
    bannerList:[],
    floorsList:[]
};
const actions = {
    // 获取三级联动列表数据
    async categoryList({commit}){
        let result =await getBaseCategoryList()
        if(result.code == 200){
            commit('CATEGORYLIST',result.data)
        }
    },
    // 获取home首页大的轮播图数据
    async getBannerList({commit}){
        let result2 = await reqBannerList();
        // console.log(result2);
        if(result2.code == 200){
            commit('GETBANNERLIST',result2.data)
        }
    },
    // 获取home首页小的轮播图数据
    async getFloorsList({commit}){
        let result3 = await reqFloorsList();
        if(result3.code == 200){
            commit("GETFLOORSLIST",result3.data)
        }
    }
};
const mutations ={
    CATEGORYLIST(state,value){
        state.categoryList = value;
    },
    GETBANNERLIST(state,value){
        state.bannerList = value;
    },
    GETFLOORSLIST(state,value){
        state.floorsList = value;
    }
};
const getters = {};
export default {
    state,
    actions,
    mutations,
    getters
}